<template>
  <!--
        作者：1550495493@qq.com
        时间：2019-08-15
        描述：基地材料
    -->
  <div class="HomePage">
    <div class="location">
      <div class="location-text fl">
        <img class="location-img fl" src="../../images/BaseManager/material.png" />
        <p class="fr">基地材料</p>
      </div>
      <img class="biaotibg fl" src="../../images/home/biaotibg.png" />

    </div>
    <div class="IssuedNotice-box">
      <div class="search-box">
        <div class="fl">
          <input class="search" id="searchRoleVal" type="text" />
          <input class="btn" type="button" @click="searchData" value="搜索" />
        </div>
        <input @click="SpecialistBtnView" class="btn fr" type="button" value="新增材料" />
      </div>
    </div>
    <div class="PressRelease-list">
      <table>
        <thead>
        <tr>
          <th class="table-text-th4">材料名称</th>
          <th class="table-text-th1"> 材料类别 </th>
          <th class="table-text-th1">上传时间</th>
        <!--  <th class="table-text-th1">材料附件 </th>-->
          <th class="table-text-th3">操作</th>
        </tr>
        </thead>
        <tbody>
        <tr v-if="total == 0">
          <td colspan="4" class="center">暂无数据！</td>
        </tr>
        <tr v-else v-for="att in tableData">
          <td :title="att.name"> <span class="show-oneline-table">{{att.name}}</span></td>
          <td>{{att.type == 1?'验收材料':'评审材料'}}</td>
          <td>{{ formatData(att.createAt)}}</td>

      <!--    <td><input type="button" @click="downloadResources(att.attachment)" value="下载" class="delete" /></td>-->
          <td>
            <input type="button" @click="SpecialistBtn(att.id, 6,att.baseId)" value="查看" class="delete write" />
            <input @click="SpecialistBtn(att.id,0,att.baseId)" type="button" value="修改" class="delete write" />
            <input type="button" @click="delAtt(att.id)" value="删除" class="delete write" />
          </td>
        </tr>

        </tbody>
      </table>
      <!--total  数据总数   size  一页多少条数据   page  当前页码    changge 返回当前选择的页码  改变一页显示条 child  返回值就是一页显示条数  -->
      <pageination :total="total" :size="size" :page="page" :changge="pageFn" @child="obtainChild"></pageination>
    </div>
    <!-- 新增材料-模态框-->
    <div v-show="Specialist" class="tenant-model">
      <div class="tenant-model-content Specialist">
        <header class="tenant-model-header ">
          <h3>{{typeName}}材料</h3>
          <span @click="closeModel" class="closeModel">×</span>
        </header>
        <div class="tenant-model-body">
          <div class="search-contain">
            <!--模态框内容板块-->
            <div class="review-table">
              <div class="review">
                <form class="form-box" id="baseAttrForm">
                	<div class="after">
	                  <div class="form-line fl input-required">
	                    <label>材料名称：</label>
	                    <div class="input-box">
	                      <input type="text" name="name" v-model="obj.name"  />
	                    </div>
	                  </div>

	                  <div class="form-line fr input-required">
	                    <label>材料类别：</label>
	                    <div class="input-box">
	                      <select name="type" id="type">
	                        <option value="" >请选择</option>
	                        <option value="1" >验收材料</option>
	                        <option value="2">评审材料</option>
	                      </select>
	                    </div>
	                  </div>
                  </div>
                  <div class="form-line input-required">
                    <label>基地名称：</label>
                    <div class="input-box">
                      <select name="baseId" id="viewBaseId">
                        <option value="">请选择</option>
                        <option :value="b.id" v-for="b in baseSelect">{{b.name}}</option>
                      </select>
                    </div>
                  </div>
                  <div class="search-boxs form-line imgbox">
                    <label class="enclosure">附件：</label>
                    <input name="attachment"  type="hidden" v-model="attachment" />
                    <input type="file" id="handIdFront" accept=".doc,.docx,.xls,.xlsx,.pdf,.html,.txt,image/jpeg,image/tif,image/gif,image/png,image/bmp,.mp3,.mp4,.wav,.flv,.avi" @change="idFrontImg($event)" style="display: none;" />
         <!--           <a v-if="typeName == '新增'" class="Public-btn1 uploadbtn handIdFrontA " @click="toSrc(obj.attachment)">预览</a>-->
                    <a class="Public-btn1 uploadbtn handIdFrontA " @click="touchOffIdInput(1)">上传附件</a>
                    <a class="Public-btn1 uploadbtn handIdFrontA " @click="delAtts()" v-if="FileUpload.length">删除附件</a>

                    <ul class="img-box upload" v-if="FileUpload.length">
                      <li v-for="item in FileUpload" >{{item}}</li>
                    </ul>
                  </div>

                </form>

              </div>

              <footer class="tenant-model-footer">
                <button  class="determine" @click="subBaseAttr">{{typeThe}}</button>
              </footer>


            </div>

          </div>
        </div>
      </div>
    </div>

    <!-- chakan材料-模态框-->
    <div v-show="viewSpecialist" class="tenant-model">
      <div class="tenant-model-content">
        <header class="tenant-model-header ">
          <h3>查看材料</h3>
          <span @click="closeModel" class="closeModel">×</span>
        </header>
        <div class="tenant-model-body">
          <div class="search-contain look-material">
            <!--模态框内容板块-->
            <div class="review-table">
              <div class="review">
                <form class="form-box">
                  <div class="after">
                    <div class="form-line fl">
                      <label>材料名称：</label>
                      <span>{{obj.name}}</span>
                      <!--<div class="input-box">
                        <input type="text" readonly name="name" v-model="obj.name"  />
                      </div>-->
                    </div>

                    <div class="form-line fr">
                      <label>材料类别：</label>
                      <span v-if="obj.type == 1">验收材料</span>
                      <span v-if="obj.type == 2">评审材料</span>
                     <!-- <div class="input-box">
                        <select name="type"  id="type">
                          <option value="" >请选择</option>
                          <option value="1" :selected="obj.type == 1" >验收材料</option>
                          <option value="2" :selected="obj.type == 2">评审材料</option>
                        </select>
                      </div>-->
                    </div>
                  </div>
                  <div class="form-line material-name">
                    <label>基地名称：</label>
                    <span v-for="b in baseSelect" v-if="b.id==obj.baseId">{{b.name}}</span>
                   <!-- <div class="input-box">
                      <select  name="baseId"  id="baseId" >
                        <option value="">请选择</option>
                        <option :value="b.id" v-for="b in baseSelect">{{b.name}}</option>
                      </select>
                    </div>-->
                  </div>

                  <div class="form-line">
                    <label>附件：</label>
                    <div class="input-box">
                        <a @click="toSrc(obj.attachment)" class="Public-btn1">预览</a>
                    </div>
                  </div>

                </form>

              </div>




            </div>

          </div>
        </div>
      </div>
    </div>

  </div>

</template>
<script src="./TheBaseMaterial.js"></script>

<style scoped>
  @import "TheBaseMaterial.css";
</style>
